<!DOCTYPE html>
<html>

<head>
<title>产品价格</title>
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<%include("/common/include.html"){}%>
<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>

<body class="easyui-layout">
	<div data-options="region:'center',border: false">
			<div class="easyui-layout" data-options="fit:true,border: false">
				<div id="table_div" data-options="region:'north',split: true,border: false" style="height:70%">
					<%include("/productPriceSet/priceTable.html", {'childGridId':'oldPriceTable'}){}%>
				</div>
				<div data-options="region:'center',border: false">
					<table id="oldPriceTable" style="height:100%;"></table>
				</div>
			</div>
	    </div>
	<div id="menuContent" class="menuContent" style="display: none; position: absolute;">
		<ul id="organSelectTree" class="ztree" style="margin-top: 0;width: 200px;"></ul>
	</div>
<script type="text/javascript">
	var setting = {
		async : {
			enable : true,
			url : '${cxt!}/organization/treeData',
			autoParam : [ "id=ids" ],//, "name=n", "level=lv"
			type : "post"
		},
		view : {
			dblClickExpand : false
		},
		data : {
			simpleData : {
				enable : true
			}
		},
		callback : {
			onClick : onClick
		}
	};

	function onClick(e, treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("organSelectTree"), nodes = zTree
				.getSelectedNodes(), v = "";
		nodes.sort(function compare(a, b) {
			return a.id - b.id;
		});
		for (var i = 0, l = nodes.length; i < l; i++) {
			v += nodes[i].name + ",";
		}
		if (v.length > 0)
			v = v.substring(0, v.length - 1);
		var cityObj = $("#organ");
		cityObj.attr("value", v);
		$("#organIds").attr("value", treeNode.id);
		$('#priceIds').combobox('clear');
		var organIds = $("#organIds").val();
		/* if(organIds =='${curOrgan.ids! }' ){
			
			document.getElementById("add").style.display="inline-block";
			document.getElementById("edit").style.display="inline-block";
		}else{
			document.getElementById("add").style.display="none";
			document.getElementById("edit").style.display="none";
		} */
		initPriceSelect(treeNode.id);
	}
	function showMenu() {
		var cityObj = $("#organ");
		var cityOffset = $("#organ").offset();
		$("#menuContent").css({
			left : cityOffset.left + "px",
			top : cityOffset.top + cityObj.outerHeight() + "px"
		}).slideDown("fast");

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn"
				|| event.target.id == "menuContent" || $(event.target)
				.parents("#menuContent").length > 0)) {
			hideMenu();
		}
	}
	$.fn.zTree.init($("#organSelectTree"), setting);
</script>

</body>